import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';

export default async function a003(fd: IFeidaoAiBrowserComponent) {
	const node = get(fd, 'Jx') as { _id: string; };
	const id = node._id;
	console.log(id);


	// 保存修改联系人
	const lxr = fd.data.node.querySelector<HTMLInputElement>('[data-name="lxr"]');
	const contact = lxr.value;

	const lxd = fd.data.node.querySelector<HTMLInputElement>('[data-name="lxd"]');
	const contact_number = lxd.value;

	const wx = fd.data.node.querySelector<HTMLInputElement>('[data-name="wx"]');
	const wechat_no = wx.value;

	const emi = fd.data.node.querySelector<HTMLInputElement>('[data-name="emi"]');
	const mail_box = emi.value;

	const qq1 = fd.data.node.querySelector<HTMLInputElement>('[data-name="qq"]');
	const qq = qq1.value;

	const res = await nodejs<{ code: number; result: string; }>('customer-care/zj-000006/s001', {
		filter: {
			_id: id,
			contact,
			contact_number,
			wechat_no,
			mail_box,
			qq

		}
	});
	if (res.code === 1) {
		alert('成功！');
		window.location.reload();
	} else {
		alert('失败!');
	}
}
